#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "../Public/public.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    connect(ui->btn_cal,SIGNAL(clicked(bool)),this,SLOT(cal()));


    myCDataAnalog * analog1 = new myCDataAnalog();
     QMetaObject*  qobj = (QMetaObject *)analog1->metaObject();

     string strTemp = qobj->className();

     analog1->FreshData(0.5);

     myCDataSwitch * switch1 = new myCDataSwitch();
     switch1->FreshData(true);







   // myCData* pData2 = (myCData*) myCDataSwitch::staticMetaObject.newInstance();

}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::cal()
{
    int nCount = myCData::s_mapTypeToClass.count();

   bool ok;
   QString tempStr,tempStr1,tempStr2;
   tempStr1 = ui->lenum1->text();
   tempStr2 = ui->lenum2->text();
   int tempInt1,tempInt2;
   tempInt1 = tempStr1.toInt(&ok);
   tempInt2 = tempStr2.toInt(&ok);
   int valueRes = myCCRC8::add(tempInt1,tempInt2);

   ui->lblValue->setText(tempStr.setNum(nCount));

 //  ui->lblValue->setText(tempStr.setNum(valueRes));
}
